home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d18 / tpsbk100.arc / TPSBK.DOC < prev   
Text File  |  1991-07-28  |  54KB  |  1,485 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                  Turbo Pascal SoundBlaster Toolkit Version 1.00
  14.                    TPSBK(tm)
  15.                  User's Manual
  16.  
  17.  
  18.  
  19.                   Copyright(C) 1991 by
  20.                 Trevor Robinson
  21.                   All Rights Reserved
  22.  
  23.  
  24.  
  25.                 Trevor Robinson
  26.                   5201 Teakwood Trace
  27.                    Midland, TX. 79707
  28.  
  29.  
  30.  
  31.               Written using Turbo Pascal v6.0
  32.  
  33.  
  34.  
  35.  
  36.     TPSBK  v1.00              License                i
  37.  
  38.  
  39.        L I C E N S E
  40.        ______________________________________________________________________
  41.  
  42.        CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS.  IF YOU DO NOT
  43.        AGREE WITH THEM, YOU SHOULD PROMPTLY DELETE THE ENTIRE TOOLKIT.
  44.        USING THIS SOFTWARE INDICATES YOUR ACCEPTANCE OF THE AGREEMENT.
  45.  
  46.        The Turbo Pascal SoundBlaster ToolKit (TPSBK) is not Public Domain and
  47.        it is  not  free.  It is  Copyright(c) 1991  by Trevor  Robinson.  All
  48.        rights are reserved.
  49.  
  50.        Brand and product names mentioned are  trademarks or registered trade-
  51.        marks of their respective holders.
  52.  
  53.        Non-registered users of this program are  granted a limited three-week
  54.        license    to  TPSBK  to  evaluate  the  programs    suitability for their
  55.        requirements.  Any  usage  of  TPSBK  beyond  evaluation  time  period
  56.        requires registration  of each copy of the program used.   Use of non-
  57.        registered  copies of TPSBK beyond  the original evaluation  period is
  58.        prohibited.
  59.  
  60.        TPSBK  may  NOT    be modified in any respect, for any reason, including
  61.        but  not  limited   to,   de-compiling,   disassembling,   or  reverse
  62.        engineering of  the program.   The registration screen  and all    other
  63.        proprietary program output must never be altered, removed, bypassed or
  64.        modified by any means.
  65.  
  66.        You are free to distribute the PUBLICLY AVAILABLE shareware version of
  67.        TPSBK to  others  subject  to  the  above  restrictions    and  also the
  68.        following:
  69.  
  70.           A.   No fee is charged for its use.
  71.  
  72.           B.   No re-numeration  may be  accepted  for TPSBK.  This  does not
  73.            apply to computer access charges the system operators (Sysops)
  74.                of  or  organizations  owning  bulletin  board systems, online
  75.                services, etc... may charge subscribers.
  76.  
  77.       C.   TPSBK  must be  copied in unaltered form, complete  with files
  78.            containing license information, the FULL documentation and all
  79.            accompanying files.  The archive distributed by me must not be
  80.            altered in ANY respect.
  81.  
  82.           D.   All shareware  houses/distribution firms  must make explicitly
  83.                clear that  the  diskette  purchase  containing  any shareware
  84.            program has NOT registered the shareware with me.
  85.  
  86.        System Operators  may make  TPSBK  available for  download only if the
  87.        above conditions are met.  The archive  (TPSBK100.ZIP)  distributed by
  88.        me or  an equivalent  archive may be  made available  only in complete
  89.        form.  Refer  to section  FILE  LISTING    to  verify  complete  package
  90.        contents.  If the  contents appear  altered or  not complete,  you may
  91.        obtain the  latest release  of TPSBK  directly  from  me by  sending a
  92.        formatted  diskette labeled with  the word "TPSBK".  Please include $5
  93.        for handling.
  94.  
  95.     TPSBK  v1.00              License                ii
  96.  
  97.  
  98.  
  99.         
  100.        Commercial distributors of "Public  Domain", "Shareware",  and/or User
  101.        Supported  software  may  distribute   TPSBK   subject  to  the    above
  102.        conditions  only  after    obtaining  WRITTEN  permission from me.  This
  103.        condition statement supersedes all previous agreements.
  104.  
  105.        Please refer to the section entitled registration/ordering section for
  106.        additional information  on registration.
  107.        ______________________________________________________________________
  108.  
  109.        The above license  statement does not  apply to    the REGISTERED version
  110.        of TPSBK.  The  registered  software is protected  under United    States
  111.        Copyright.  It must be treated just like a book with certain exceptions
  112.        as follows:
  113.  
  114.        A. I authorize the making of archival copies of the registered software
  115.       for the sole purpose of backing-up your software and protecting your
  116.       investment from possible loss.
  117.  
  118.        B. The  medium  on  which  the  registered  software  is  recorded  is
  119.           transferred to the customer, but not the title to the software.
  120.  
  121.        C. The  customer  may  resell  or  distribute unmodified copies of the
  122.       registered software provided the customer has purchased from me one
  123.       copy of the  registered software for    each one sold or distributed.
  124.       The provisions of this software license shall also be applicable to
  125.       third parties receiving copies of the  registered software from the
  126.       customer.
  127.  
  128.        D. You may transfer this software and license to another party if the
  129.       other  party agrees  to accept  the terms  and conditions  of this
  130.       license,  and you either  transfer or  destroy all  copies in your
  131.       possession  whether in  printed or  machine- readable form.    This
  132.       includes  all portions  of the  software contained  or merged into
  133.       other programs.
  134.  
  135.        E. By saying, "just like a book",  I  mean that the registered software
  136.       may be used by any number of people and may be freely moved from one
  137.       computer  location to  another so  long as  there is    ABSOLUTELY  NO
  138.       POSSIBILITY  of it being  used at one  location while  being used at
  139.       another.  Just  like a book  that cannot  be read  by two  different
  140.       people in  two  different  locations at  the same  time.
  141.  
  142.        F. You may  include this software in your  applications and  distribute
  143.       them at your discretion.   You may not  distribute any portion(s) of
  144.       software that are not integrated into your application.
  145.  
  146.        G. You may NOT include this software in programs that are toolkits!
  147.  
  148.        This license is effective until terminated.   You may terminate it at
  149.        any time by destroying the software together with all copies, modifi-
  150.        cations and merged portions in any form.  The license also terminates
  151.        if you fail to comply with the terms and conditions of the agreement.
  152.  
  153.     TPSBK  v1.00              License               iii
  154.  
  155.  
  156.  
  157.  
  158.        O R D E R I N G     I N F O R M A T I O N
  159.        ______________________________________________________________________
  160.  
  161.        Once a registered user of TPSBK,  you are free to utilize  the program
  162.        as often as you wish.  Other than having a clear conscience, there are
  163.        many  advantages  to  registered.   You    will  receive  in  the mail a
  164.        registered  version of  TPSBK with  the registration  screen and delay
  165.        removed,  a printed  copy of the  documentation, and you  will also be
  166.        notified in the    mail when significant  enhancements have been made to
  167.        the program.  Once  registered,    all upgrades are  available  for a $5
  168.        upgrade fee plus the original TPSBK diskette (see below).
  169.  
  170.        For $15 dollars plus an    additional $5 for  shipping/handling,  I will
  171.        send you the latest shareware and registered versions of TPSBK on disk
  172.        along with the printed documentation.
  173.  
  174.        If unsure, you can  receive the latest  shareware version of TPSBK for
  175.        evaluation by sending a formatted diskette plus $5 for handling.
  176.  
  177.        Please use the following form or print the included file "MAILER" when
  178.        placing an order.
  179.  
  180.        Non-U.S. residents : I can only accept U.S. currency.   Also add $5 to
  181.        cover overseas shipping/handling.
  182.  
  183.  
  184.        U P G R A D I N G   T O     L A T E S T   T P S B K
  185.        ______________________________________________________________________
  186.  
  187.        Users who have registered (and received a diskette) may upgrade to the
  188.        latest version of TPSBK by sending in their TPSBK ORIGINAL DISK, along
  189.        with $5 (service and handling).     Please use the  following order form
  190.        when upgrading.     If there has been an address change, please indicate
  191.        so on the order form.
  192.  
  193.        The original  disk must be returned and contain the registered version
  194.        of TPSBK.  The disk will be  reformatted and the current Master copied
  195.        onto it.  Any  disk in poor condition will be  replaced by me.  If the
  196.        serial number label is  missing or the diskette does not  contain  the
  197.        registered  version  of    TPSBK,    the update  will be  refused  and the
  198.        diskette returned unchanged.
  199.  
  200.  
  201.  
  202.     TPSBK  v1.00             Ordering                iv
  203.  
  204.  
  205.  
  206.        O R D E R   F O R M
  207.        ______________________________________________________________________
  208.  
  209.  
  210.  
  211.        Please Remit To:    Trevor Robinson
  212.                5201 Teakwood Trace
  213.                Midland, TX. 79707
  214.  
  215.  
  216.        Qty.    Description                                  Each    Total
  217.  
  218.        ____    TPSBK  Upgrade to new version            $5.00   ________
  219.                (When available)
  220.                (You must return your original diskette 
  221.                 containing your copy of the registered 
  222.         version of TPSBK)
  223.  
  224.        ____    TPSBK  Evaluation Copy                $5.00   ________
  225.                (You supply diskette, no registration)
  226.  
  227.        ____    TPSBK  Registration with diskette       $20.00   ________
  228.                (Registration including diskette with the
  229.                 latest shareware and registered program
  230.         versions along with printed manual)
  231.                                                          Subtotal   ________
  232.  
  233.       (Foreign orders add $5 shipping & handling)     Shipping   ________
  234.  
  235.       (TX residents please add 7.75% sales tax)          Tax   ________
  236.  
  237.                                                             TOTAL  $________
  238.  
  239.           Name: ________________________________________________________
  240.  
  241.        Company: ________________________________________________________
  242.  
  243.        Address: ________________________________________________________
  244.  
  245.                 ________________________________________________________
  246.  
  247.                 ________________________________________________________
  248.  
  249.  
  250.        Check one:    [] 5 1/4 in. disks     [] 3 1/2 in. disks
  251.  
  252.        Check one:    [] Turbo Pascal 5.5    [] Turbo Pascal 6.0
  253.  
  254.  
  255.  
  256.        All checks must be drawn on U.S. Funds in U.S. Dollars.    Sorry, no
  257.        C.O.D. orders will be accepted.
  258.  
  259.  
  260.     TPSBK  v1.00             Warranty               v
  261.  
  262.  
  263.  
  264.  
  265.        W A R R A N T Y
  266.        ______________________________________________________________________
  267.  
  268.  
  269.     TPSBK  is  provided AS IS without any warranty, expressed or implied.
  270.        This  includes  without  limitation  the  fitfulness  to  a particular
  271.        purpose or application,    that software operation will be uninterrupted
  272.        or error free, and any warranties of merchantability.
  273.  
  274.        While I have tried to be as through as possible while debugging TPSBK,
  275.        I  shall not  be liable    for any  damages,  whether direct,  indirect,
  276.        special,  or consequential  arising from a  failure of this program or
  277.        accompanying  files to  operate in a  manner desired by the  user.   I
  278.        shall not be liable for any damage to  data or property which may have
  279.        caused directly or indirectly by use of this program.
  280.  
  281.        In  no  event  will I be  liable to you for any damages, including any
  282.        lost  profits,  lost  savings  or  other  incidental or    consequential
  283.        damages    arising out of your use or  inability to use the program,  or
  284.        for any claim by any other party.
  285.        ______________________________________________________________________
  286.  
  287.        If you have a problem with   TPSBK   please  feel  free    to  write and
  288.        describe the  situation.   Registered users, please include the serial
  289.        number found on your diskette.
  290.  
  291.        To those people who  have  registered  (with  diskette),  the physical
  292.        diskette is warranted against defects in materials and workmanship for
  293.        a period of 60  days from date of  shipment by me.  Any returned disks
  294.        found damaged or bad will be replaced at no charge.
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.     TPSBK  v1.00           Table Of Contents           vii
  319.  
  320.  
  321.  
  322.  
  323.        T A B L E   O F     C O N T E N T S
  324.        ______________________________________________________________________
  325.  
  326.  
  327.        License
  328.       Single User License ....................................... i
  329.       Giving out Copies ......................................... i
  330.       System Operators (Sysops) Info ............................ i
  331.       Software Distributors - Read this ......................... ii
  332.       Registered Version License Agreement ...................... ii
  333.  
  334.        Ordering Information
  335.       Registration .............................................. iii
  336.          Upgrading to latest TPSBK .............................. iii
  337.          Registration (diskette sent out) ....................... iii
  338.          Getting a Trial Copy ................................... iii
  339.       Invoice Order Form ........................................ iv
  340.  
  341.        Warranty ..................................................... v
  342.  
  343.        Introduction ................................................. 1
  344.  
  345.        System Information ........................................... 2
  346.  
  347.        File Listing ................................................. 3
  348.  
  349.        TPSBK SoundBlaster Driver .................................... 4
  350.  
  351.        TPSBK SoundBlaster BASIC Players ............................ 12
  352.  
  353.        TPSBK SoundBlaster PianoMan Players ......................... 16
  354.  
  355.        TPSBK SoundBlaster MultiPart Player ......................... 17
  356.  
  357.        TPSBK SoundBlaster CMF Player ............................... 18
  358.  
  359.        TPSBK Demo Files ............................................ 21
  360.  
  361.        TPSBK Music Conversion Programs ............................. 22
  362.  
  363.        Appendix A:  Programmers Programming Tips .................... A
  364.  
  365.        Appendix B:  Common Questions and Answers .................... B
  366.  
  367.        Appendix C:  Revision History ................................ C
  368.  
  369.        Appendix D:  Future Enhancements ............................. D
  370.  
  371.  
  372.        TPSBK  v1.00                Introduction                     1
  373.  
  374.  
  375.  
  376.  
  377.        I N T R O D U C T I O N
  378.        ______________________________________________________________________
  379.  
  380.        The Turbo Pascal SoundBlaster Toolkit (TPSBK), is,  as far as I know,
  381.        the only  SoundBlaster  toolkit for  Turbo Pascal.   It contains many
  382.        routines to  access the  SoundBlaster.   Most don't  need any kind of
  383.        special driver.  Included in this version are routines to play Creat-
  384.        ive  Music Files,  great music  files that don't  waste a lot of disk
  385.        space.   There are  routines to play music files  containing the data
  386.        for the  BASIC PLAY verb.   They aren't the best  sounding  files but
  387.        there are many of them available and even simple music can sound good
  388.        on the SoundBlaster.   Routines for playing  PianoMan music files are
  389.        also included.  If you haven't seen PianoMan, check your local BBSes.
  390.        It is a great shareware music  composer by Neil Rubenking.  There are
  391.        many of these  files around too.   One of the best  things about this
  392.        toolkit is  that it can play all of the  mentioned files in the back-
  393.        ground... Requiring no attention from you.  It can also play multiple
  394.        part PianoMan files,  such as ENTRTAN*.MUS.  These files are included
  395.        in this archive and the  PianoMan archive.   It plays notes from each
  396.        file individually on different channels, producing quality music.
  397.  
  398.        Still,  the most powerful tool is the  ability to play  single notes.
  399.        You can use  single notes to play any file format.   They can be used
  400.        to make music composers.  You can also load custom instruments.
  401.  
  402.        Unfortunately, because the is the first version, and the SoundBlaster
  403.        is very  difficult to program,  the full  capabilities of the  Sound-
  404.        Blaster  aren't  available.   Mainly playing of voice files.   I must
  405.        write a new  driver to be able to  play files  from the disk.   There
  406.        just isn't enough memory to play most voice files.   Hopefully all of
  407.        the features listed in the Future Enhancements Section, (Appendix D),
  408.        will be available by version 2 or 3.  But the amount of work I'm able
  409.        to do depends on the response from you, the user.
  410.  
  411.  
  412.  
  413.  
  414.     TPSBK  v1.00         System Information             2
  415.  
  416.  
  417.  
  418.  
  419.        S Y S T E M   R E Q U I R E M E N T S
  420.        ______________________________________________________________________
  421.  
  422.        TPSBK  requires an IBM PC/XT/AT or close compatible running MS-DOS 2.0
  423.        or higher.   A hard drive is recommended  although it is not required.
  424.        A Creative Lab's SoundBlaster card is also required needless to say.
  425.  
  426.  
  427.  
  428.  
  429.        I N S T A L L A T I O N
  430.        ______________________________________________________________________
  431.  
  432.        If you are installing on a hard disk, copy the archive (TPSBK100.ZIP)
  433.        to your Turbo Pascal directory.
  434.  
  435.        COPY TPSBK100.ZIP C:\TP6
  436.  
  437.        You must have PKUNZIP either in your  Turbo Pascal  directory or in a
  438.        directory in you PATH variable.    Type:
  439.  
  440.        PKUNZIP TPSBK100
  441.  
  442.        If you have a  self-extracting archive (TPSBK100.EXE),  after copying
  443.        the file to the proper directory, just type:
  444.  
  445.        TPSBK100
  446.  
  447.        If you are installing on a floppy follow the same steps after copying
  448.        the file to your work disk.
  449.  
  450.        Now your ready.     To get an understanding of the toolkit, read on and
  451.        experiment with the demonstration files.
  452.  
  453.  
  454.  
  455.     TPSBK  v1.00            File Listing             3
  456.  
  457.  
  458.  
  459.  
  460.        F I L E     L I S T I N G
  461.        ______________________________________________________________________
  462.  
  463.        The following briefly lists  those files  included with  the shareware
  464.        version of TPSBK:
  465.  
  466.        MAILER.TXT     Prints out a registration form on  your printer that
  467.                          can be folded and mailed directly.
  468.        SBDRIVE.TPU     Main program that contains all basic SoundBlaster
  469.              instrument and note playing commands.
  470.        SBBASIC.TPU     Unit to play files containing data similar to that
  471.              used by the BASIC PLAY verb.
  472.        SBBKBAS.TPU     Same as SBBASIC but capable of playing in background.
  473.        SBBKMUZ.TPU     Unit to play PianoMan 4 files in background.
  474.        SBOPIANO.TPU     Unit to play PianoMan files earlier than 4 in fore-
  475.              ground.
  476.        SBNPIANO.TPU     Unit to play PianoMan 4 files in foreground.
  477.        SBOMULTI.TPU     Unit to play up to 9 PianoMan files at the same time
  478.              to produce up to 9-part harmonies.  Earlier than 4.
  479.        SBCMF.TPU     Unit to play Creative Music Files in background.
  480.        SBDEMO.PAS     Program to demonstrate all functions except back-
  481.              ground playing.
  482.        MUSICDOS.PAS     Program to demonstrate background playing.
  483.        SBCMFDEM.PAS     Program to demonstrate playing of CMF files.
  484.        MUS2MUZ.EXE     Converts old PianoMan files to PianoMan 4 files.
  485.        MUZ2MUS.EXE     Converts BASIC PLAY file to old PianoMan files.
  486.        SBDEMO.EXE     Compiled TPSBK demonstration.
  487.        MUSICDOS.EXE     Compiled Musical DOS (SBBKMUZ demonstration).
  488.        SBCMFDEM.EXE     Compiled CMF player.
  489.        SOLFE.MUZ     BASIC music file: Solfeggietto
  490.        CMINOR.MUS     Old PianoMan music file: C Minor
  491.        DIXIE.MUZ     New PianoMan music file: Dixie
  492.        ENTRTAN*.MUS     Old PianoMan multipart files: The Entertainer
  493.        PAKLBEL*.MUS      Old PianoMan multipart files: PAKLBEL
  494.        BADMAN.CMF     Awesome Creative Music File
  495.  
  496.  
  497.     TPSBK  v1.00          TPSBK SoundBlaster Driver          4
  498.  
  499.  
  500.  
  501.  
  502.        S O U N D B L A S T E R     D R I V E R
  503.        ______________________________________________________________________
  504.  
  505.  
  506.        INTERFACE SECTION FOR SBDRIVE.TPU :
  507.  
  508.   {Turbo Pascal SoundBlaster Driver by Trevor Robinson
  509.    Copyright (c) 1991, Trevor Robinson
  510.  
  511.   Unit SBDrive;
  512.  
  513.   Interface
  514.  
  515.   Uses
  516.     CRT;
  517.  
  518.   Type
  519.     InstType = Array [0..15] Of Byte;
  520.  
  521.   Const
  522.     SBDVersion = $0100;
  523.  
  524.   Var
  525.     SBIOAddr : Word;
  526.  
  527.   Function FindIOAddr : Word;
  528. { Searches ports $220 - $260 for SoundBlaster card.  Returns 0 if not
  529.   installed.  This routine sets SBIOAddr at startup time.
  530.  
  531.   NOTE:  To be compatible with AdLib cards, these FM music routines use
  532.   ports $388 and $389.  If FindIOAddr returns 0, an AdLib card may still
  533.   be installed.
  534. }
  535.  
  536.   Function StatusRegister : Byte;
  537. { Returns the FM status register:
  538.  
  539.  ┌──────────────────────────────────────────────────────────────────┐
  540.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  541.  ├────────┬───────────────┬─────────────────────────────────────────┤
  542.  │  IRQ   │     FLAG      │                        │
  543.  │      │  T1   │  T2   │                        │
  544.  └────────┴───────┴───────┴─────────────────────────────────────────┘
  545. }
  546.  
  547.   Procedure InitCard;
  548. { This must be called to initialize the FM synthesizer chips. }
  549.  
  550.   Procedure SetTimer1(Count : Byte);
  551. { Timer1 is an 8 bit presettable counter.  It has a resolution of 80usec.
  552.   Count is the preset value to be loaded into the counter.  If an overflow
  553.   occurs, the Timer1 flag in the status register is set, and the preset
  554.   value is reloaded into the counter.  In addition to normal timer func-
  555.   tions, Timer1 is also used for control of composite speech synthesis. }
  556.  
  557.   Procedure SetTimer2(Count : Byte);
  558. { Timer2 is similar to Timer1 except that its resolution is 320usec. }
  559.  
  560.  
  561.  
  562.        TPSBK  v1.00          TPSBK SoundBlaster Driver              5
  563.  
  564.  
  565.  
  566.   Procedure TimerControl(Control : Byte);
  567. { This procedure is used to start, stop and control flags of the timers.
  568.  
  569.  ┌──────────────────────────────────────────────────────────────────┐
  570.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  571.  ├────────┬───────────────┬───────────────────────┬─────────────────┤
  572.  │  IRQ   │     MASK      │              │   START/STOP    │
  573.  │  RST   │  T1   │  T2   │              │  T1   │   T2    │
  574.  └────────┴───────┴───────┴───────────────────────┴───────┴─────────┘
  575.  
  576.   D0 (Start/Stop Timer1)
  577.     When this bit is 1, the preset value is loaded into Timer1 and
  578.     counting starts.  When this bit is 0, Timer1 does not operate.
  579.   D1 (Start/Stop Timer2)
  580.     Performs the same function as D0 for Timer2.
  581.   D5 (Mask Timer2)
  582.     When this bit is 1, the flag for Timer2 in the status register is
  583.     masked (always 0).
  584.   D6 (Mask Timer1)
  585.     Bit mask flag for Timer1.
  586.   D7 (IRQ-RESET)
  587.     When set to 1, the IRQ and Timer flags in the status register are
  588.     reset to 0.  This bit then resets itself to 0. }
  589.  
  590.   Procedure CSMMode_KbdSplit(MKS : Byte);
  591. { This procedure causes the synthesizer to operate in music mode or speech
  592.   synthesis mode and determines the keyboard split for keyboard scaling of
  593.   rate.
  594.  
  595.  ┌──────────────────────────────────────────────────────────────────┐
  596.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  597.  ├────────┬───────┬─────────────────────────────────────────────────┤
  598.  │  CSM   │  SEL  │                            │
  599.  └────────┴───────┴─────────────────────────────────────────────────┘
  600.  
  601.   D6 (NOTE SELECT)
  602.     This bit controls the split point of the keyboard.    When 0, the key-
  603.     board split is the second bit from the most significant bit of the
  604.     F-Number.  The MSB of the F-Number is used when 1.
  605.  
  606.     NOTE SELECT = 0
  607.  ┌────────────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐
  608.  │   OCTAVE   │   0   │   1   │   2   │   3   │   4   │   5   │   6   │   7   │
  609.  ├────────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
  610.  │ BLOCK DATA │   0   │   1   │   2   │   3   │   4   │   5   │   6   │   7   │
  611.  ├────────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
  612.  │ F-NUMBER 9 │   1   │   1   │   1   │   1   │   1   │   1   │   1   │   1   │
  613.  ├────────────┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┤
  614.  │ F-NUMBER 8 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │
  615.  ├────────────┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
  616.  │ SPLIT NUM  │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │10 │11 │12 │13 │14 │15 │
  617.  └────────────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
  618.  
  619.  
  620.  
  621.        TPSBK  v1.00          TPSBK SoundBlaster Driver              6
  622.  
  623.  
  624.  
  625.     NOTE SELECT = 1
  626.  ┌────────────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐
  627.  │   OCTAVE   │   0   │   1   │   2   │   3   │   4   │   5   │   6   │   7   │
  628.  ├────────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
  629.  │ BLOCK DATA │   0   │   1   │   2   │   3   │   4   │   5   │   6   │   7   │
  630.  ├────────────┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┼───┬───┤
  631.  │ F-NUMBER 9 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │ 0 │ 1 │
  632.  ├────────────┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤
  633.  │ SPLIT NUM  │ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │10 │11 │12 │13 │14 │15 │
  634.  └────────────┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┴───┘
  635.  
  636.   D7 (CSM)
  637.     The composite sine wave speech synthesis mode is selected when 1.  All
  638.     channels must be off when this mode is selected. }
  639.  
  640.   Procedure AM_VIB_EG_KSR_Multiple(InstNum, Modulator, Carrier : Byte);
  641. { This procedure controls several parameters affecting the timbre of the
  642.   output signal.
  643.  
  644.  ┌──────────────────────────────────────────────────────────────────┐
  645.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  646.  ├────────┬───────┬───────┬───────┬─────────────────────────────────┤
  647.  │   AM   │  VIB  │  EG   │  KSR  │           MULTIPLE         │
  648.  └────────┴───────┴───────┴───────┴─────────────────────────────────┘
  649.  
  650.   D0-D3 (MULTIPLE)
  651.     The basic FM equation with the multiplication factor included is:
  652.  
  653.       F(t) = A sin (Mc Wc t + I sin (Mm Wm t))
  654.  
  655.     where A is the output amplitude
  656.       I is the modulation index (amplitude of Modulator)
  657.       Wc is the carrier frequency
  658.       Wm is the modulator frequency
  659.       Mc is the multiplication factor for Carrier cell
  660.       Mm is the multiplication factor for Modulator cell
  661.  
  662.     The relationship between MULTIPLE and multiplication factor is:
  663.     ┌──────────┬────────────────┐  ┌──────────┬────────────────┐
  664.     │ MULTIPLE │ MULTIPLICATION │  │ MULTIPLE │ MULTIPLICATION │
  665.     │           │     FACTOR    │  │          │     FACTOR     │
  666.     ├──────────┼────────────────┤  ├──────────┼────────────────┤
  667.     │      0    │       0.5    │  │     8    │        8       │
  668.     │      1    │    1    │  │     9    │        9       │
  669.     │      2    │    2    │  │     A    │       10       │
  670.     │      3    │    3    │  │     B    │       10       │
  671.     │      4    │    4    │  │     C    │       12       │
  672.     │      5    │    5    │  │     D    │       12       │
  673.     │      6    │    6    │  │     E    │       15       │
  674.     │      7    │    7    │  │     F    │       15       │
  675.     └──────────┴────────────────┘  └──────────┴────────────────┘
  676.  
  677.  
  678.        TPSBK  v1.00          TPSBK SoundBlaster Driver              7
  679.  
  680.  
  681.  
  682.   D4 (KEY SCALING RATE)
  683.     When this bit is set to 1, the envelope length is gradually shortened
  684.     as higher notes on the keyboard are played.
  685.   D5 (ENVELOPE TYPE)
  686.     A diminishing sound is selected when this bit is 0 and a continuous
  687.     sound when it is 1.
  688.   D6 (VIBRATO)
  689.     Setting this bit to 1 cause a vibrato effect to be applied to the
  690.     operator cell.
  691.   D7 (AMPLITUDE MODULATION)
  692.     Setting this bit to 1 causes tremolo to be applied to operator cell. }
  693.  
  694.   Procedure KSL_TotalLevel(InstNum, Modulator, Carrier : Byte);
  695. { This procedure controls the attenuation of the operator cells' output
  696.   signal.
  697.  
  698.  ┌──────────────────────────────────────────────────────────────────┐
  699.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  700.  ├────────────────┬─────────────────────────────────────────────────┤
  701.  │    KSL      │               TOTAL LEVEL            │
  702.  └────────────────┴─────────────────────────────────────────────────┘
  703.  
  704.   D0-D5 (TOTAL LEVEL)
  705.     The TOTAL LEVEL attenuates the operator's output.  Varying the output
  706.     level of an operator functioning as a carrier results in a change in
  707.     the overall level of the sound contributed to the voice by that operator.
  708.     This is how the volume changes.  Attenuating the output from a modulator
  709.     will change the frequency spectrum produces by the carrier.  TOTAL LEVEL
  710.     has a range of 0 to 63.  Maximum attenuation is 47.25 dB.  Degree of
  711.     attenuation is given be the following formula.
  712.  
  713.       Attenuation = TOTAL LEVEL * 0.75 dB
  714.  
  715.   D6-D7 (KEYBOARD SCALING LEVEL)
  716.     The KSL produces a gradual decrease in note output level towards higher
  717.     pitch notes.  The degree of attenuation is controlled as follows:
  718.     ┌────┬────┬───────────────────────┐
  719.     │ D7 │ D6 │ Degree of Attenuation │
  720.     ├────┼────┼───────────────────────┤
  721.     │  0 │  0 │           0           │
  722.     │  1 │  0 │       1.5dB/OCT       │
  723.     │  0 │  1 │        3dB/OCT        │
  724.     │  1 │  1 │        6dB/OCT        │
  725.     └────┴────┴───────────────────────┘
  726. }
  727.  
  728.  
  729.  
  730.        TPSBK  v1.00          TPSBK SoundBlaster Driver              8
  731.  
  732.  
  733.  
  734.   Procedure Attack_Decay(InstNum, Modulator, Carrier : Byte);
  735. { The ATTACK RATE is the rising time for the sound.  The DECAY RATE is the
  736.   diminishing time after the attack.  These rates range from 0 to 15.
  737.  
  738.  ┌──────────────────────────────────────────────────────────────────┐
  739.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  740.  ├────────────────────────────────┬─────────────────────────────────┤
  741.  │        ATTACK RATE       │          DECAY RATE        │
  742.  │   2^3     2^2     2^1     2^0  │   2^3     2^2     2^1     2^0   │
  743.  └────────────────────────────────┴─────────────────────────────────┘
  744. }
  745.  
  746.   Procedure Sustain_Release(InstNum, Modulator, Carrier : Byte);
  747. { For continuing sounds, the SUSTAIN LEVEL gives the point of change where
  748.   the attenuated sound in the decay mode changes to a sound having a con-
  749.   stant level.    For diminishing sounds, the sustain level gives the point
  750.   where the decay mode changes to the release mode.
  751.  
  752.   For continuing sounds, the RELEASE RATE defines the rate at which the
  753.   sound disappears after the notes is turned off.  For diminishing sounds,
  754.   release rate indicates the attenuation after the sustain level is reached.
  755.  
  756.  ┌──────────────────────────────────────────────────────────────────┐
  757.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  758.  ├────────────────────────────────┬─────────────────────────────────┤
  759.  │       SUSTAIN LEVEL      │         RELEASE RATE        │
  760.  │   24dB    12dB    6dB     3dB  │   2^3     2^2     2^1     2^0   │
  761.  └────────────────────────────────┴─────────────────────────────────┘
  762. }
  763.  
  764.   Procedure Block_FNum(InstNum, Modulator, Carrier : Byte);
  765. { This procedure determines the octave and frequency of the output signal.
  766.  
  767.  ┌──────────────────────────────────────────────────────────────────┐
  768.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  769.  ├──────────────────────────────────────────────────────────────────┤
  770.  │               F-NUMBER (L)                 │
  771.  ├────────────────┬───────┬───────────────────────┬─────────────────┤
  772.  │          │ KEYON │        BLOCK      │  F-NUMBER (H)   │
  773.  └────────────────┴───────┴───────────────────────┴─────────────────┘
  774.  
  775.   D0-D7 (F-NUMBER L) & D0-D1 (F-NUMBER H)
  776.     The F-Number is a 10 bit number that determines the frequency of the
  777.     output signal.
  778.   D2-D4 (BLOCK)
  779.     These 3 buts determine the octave of the output signal.
  780.   D5 (KEYON)
  781.     When this be is 1, the channels is ON and voiced.  When 0, the channel
  782.     is OFF.
  783.  
  784.   The relationship among F-NUMBER, BLOCK and output frequency is as follows:
  785.  
  786.     FREQUENCY = 50000 * F-NUMBER * 2^BLOCK-20
  787.  
  788.  
  789.        TPSBK  v1.00          TPSBK SoundBlaster Driver              9
  790.  
  791.  
  792.   FREQUENCY FOR BLOCK 4
  793.   ┌──────┬───────────┬──────────┬────────┬────────────────────────────────┐
  794.   │     │         │        │ FNUM H │         F-NUMBER L       │
  795.   │ NOTE │ FREQUENCY │ F-NUMBER ├────────┼────────────────────────────────┤
  796.   │     │         │        │ D1  D0 │ D7  D6  D5  D4  D3  D2  D1  D0 │
  797.   ├──────┼───────────┼──────────┼────────┼────────────────────────────────┤
  798.   │  C#  │   277.2   │      363    │  0   1 │  0    1   1    0   1    0   1    1 │
  799.   │  D     │   293.7   │      385    │  0   1 │  1    0   0    0   0    0   0    1 │
  800.   │  D#  │   311.1   │      408    │  0   1 │  1    0   0    1   1    0   0    0 │
  801.   │  E     │   329.6   │      432    │  0   1 │  1    0   1    1   0    0   0    0 │
  802.   │  F     │   349.2   │      458    │  0   1 │  1    1   0    0   1    0   1    0 │
  803.   │  F#  │   370.0   │      485    │  0   1 │  1    1   1    0   0    1   0    1 │
  804.   │  G     │   392.0   │      514    │  1   0 │  0    0   0    0   0    0   1    0 │
  805.   │  G#  │   415.3   │      544    │  1   0 │  0    0   1    0   0    0   0    0 │
  806.   │  A     │   440.0   │      577    │  1   0 │  0    1   0    0   0    0   0    1 │
  807.   │  A#  │   466.2   │      611    │  1   0 │  0    1   1    0   0    0   1    1 │
  808.   │  B     │   493.9   │      647    │  1   0 │  1    0   0    0   0    1   1    1 │
  809.   │  C     │   523.3   │      686    │  1   0 │  1    0   1    0   1    1   1    0 │
  810.   └──────┴───────────┴──────────┴────────┴────────────────────────────────┘
  811. }
  812.  
  813.   Procedure AMVIBDepth_Rhythm(RegData : Byte);
  814. { This allows for control of amplitude modulation and vibrato depth, selec-
  815.   tion of rhythm mode, and ON/OFF control of various rhythm instruments.
  816.  
  817.  ┌──────────────────────────────────────────────────────────────────┐
  818.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  819.  ├────────────────┬───────┬───────┬───────┬───────┬───────┬─────────┤
  820.  │    DEPTH      │  RHY- │ BASS  │ SNARE │  TOM  │  TOP  │   HI    │
  821.  │   AM   │  VIB  │  THM  │ DRUM  │ DRUM  │  TOM  │  CYM  │   HAT   │
  822.  └────────┴───────┴───────┴───────┴───────┴───────┴───────┴─────────┘
  823.  
  824.   D0-D5 (RHYTHM)
  825.     The synthesizer is set to rhythm sound mode when D5 is 1.  D0-D4 allow
  826.     for ON/OFF control of the various rhythm instruments.  The last 3 FM
  827.     channels must be off.  Slots 13-18 correspond to the rhythm sound shown
  828.     below.  Data such as rate must be input as a value appropriate to each
  829.     rhythm sound.
  830.     ┌───────────────────────┬───────────────┐
  831.     │ PERCUSSION INSTRUMENT │ OPERATOR CELL │
  832.     ├───────────────────────┼───────────────┤
  833.     │       Bass Drum       │      13,16    │
  834.     │       Hi Hat          │      14       │
  835.     │       Tom Tom         │      15       │
  836.     │       Snare Drum      │      17       │
  837.     │       Top Cymbal      │      18       │
  838.     └───────────────────────┴───────────────┘
  839.   D6 (VIB DEPTH)
  840.     The vibrato depth is 14 cent when 1, 7 cent when 0.
  841.   D7 (AM DEPTH)
  842.     The tremolo depth is 4.8dB when 1, 1dB when 0.
  843. }
  844.  
  845.  
  846.        TPSBK  v1.00          TPSBK SoundBlaster Driver             10
  847.  
  848.  
  849.   Procedure WaveSelect(InstNum, Modulator, Carrier : Byte);
  850. { When Wave Select is on, the output sine wave is distorted as shown below.
  851.  
  852.  ┌──────────────────────────────────────────────────────────────────┐
  853.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  854.  ├────────────────────────────────────────────────┬─────────────────┤
  855.  │                          │    WAVE SEL     │
  856.  └────────────────────────────────────────────────┴─────────────────┘
  857.  
  858.     ┌────┬────┬──────────────┐
  859.     │ D1 │ D0 │   Waveform   │
  860.     ├────┼────┼──────────────┤
  861.     │    │    │  ┌──┐        │
  862.     │    │    │ ┌┘  └┐       │
  863.     │  0 │  0 │ └────┼────┐  │
  864.     │    │    │      └┐  ┌┘  │
  865.     │    │    │       └──┘   │
  866.     │    │    │  ┌──┐        │
  867.     │  0 │  1 │ ┌┘  └┐       │
  868.     │    │    │ └────┴─────  │
  869.     │    │    │  ┌──┐  ┌──┐  │
  870.     │  1 │  0 │ ┌┘  └┐┌┘  └┐ │
  871.     │    │    │ └────┴┴────┘ │
  872.     │    │    │  ┌─┐   ┌─┐   │
  873.     │  1 │  1 │ ┌┘ │  ┌┘ │   │
  874.     │    │    │ └──┴──┴──┴─  │
  875.     └────┴────┴──────────────┘
  876. }
  877.  
  878.   Procedure FeedBack_Connect(InstNum, RegData : Byte);
  879. { This procedure determines the modulation factor for self-feedback and
  880.   the type of FM modulation.
  881.  
  882.  ┌──────────────────────────────────────────────────────────────────┐
  883.  │    D7      D6      D5      D4      D3      D2      D1      D0    │
  884.  ├────────────────────────────────┬───────────────────────┬─────────┤
  885.  │                  │      FEEDBACK      │   CON   │
  886.  └────────────────────────────────┴───────────────────────┴─────────┘
  887.  
  888.   D0 (CONNECTION)
  889.     Connection controls the manner in which the two operator cells are
  890.     connected.  The FM modulation mode is selected when this bit is 0.
  891.     The two operator cells are connected in parallel for sine wave output
  892.     in the composite mode when this bit is 1.
  893.   D1-D3 (FEEDBACK)
  894.     Gives the modulation factor for feedback FM modulation of the first
  895.     operator cell.
  896.  
  897. ┌────────────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐
  898. │  FEEDBACK  │   0   │   1   │   2   │   3   │   4   │   5   │   6   │   7   │
  899. ├────────────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
  900. │ MODULATION │       │       │       │       │       │       │       │       │
  901. │   FACTOR   │   0   │ II/16 │ II/8  │ II/4  │ II/2  │  II   │  2II  │  4II  │
  902. └────────────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘
  903. }
  904.  
  905.        TPSBK  v1.00          TPSBK SoundBlaster Driver             11
  906.  
  907.  
  908. { High-Level Procedures }
  909.  
  910.   Procedure LoadInstrument(Inst : Byte; InstData : InstType);
  911. { This procedure loads an instrument of InstType into the FM synthesizer.
  912.   The instrument data starts at offset $24 of an SBI file.
  913. }
  914.  
  915.   Procedure NoteOn(Inst, Oct, Note : Byte);
  916. { The procedure plays a note (1-12) in an octave (0-7) on channel (1-9).
  917.   Note 1 is C#.
  918. }
  919.  
  920.   Procedure NoteOff(Inst, Oct, Note : Byte);
  921. { The procedure stops a note (1-12) in an octave (0-7) on channel (1-9).
  922.   (In this version, octave and note are ignored.)
  923. }
  924.  
  925.  
  926. Implementation
  927. End.
  928.  
  929.  
  930.        TPSBK  v1.00             TPSBK Basic Players                12
  931.  
  932.  
  933.  
  934.        B A S I C   P L A Y E R S
  935.        ______________________________________________________________________
  936.  
  937.  
  938.        INTERFACE SECTION FOR SBBKBAS.TPU :
  939.  
  940.   {Turbo Pascal SoundBlaster Basic Music Player by Trevor Robinson
  941.    Copyright (c) 1991, Trevor Robinson}
  942.  
  943.   Unit SBBKBAS;
  944.  
  945.   Interface
  946.  
  947.   Uses DOS, CRT, SBDrive;
  948.  
  949.   Type Song = Procedure;
  950.     SongAction = (EndRepeatSong,RepeatSong,ResumeSong,StopSong,SuspendSong);
  951.  
  952.   Var
  953.     BasicAborted,
  954.     BasicCheckAbort : Boolean;
  955.  
  956.  
  957.   Function BasicBackInit: boolean;
  958. { This returns true if the background buffer has been
  959.   allocated.  This function must be called before any other. }
  960.  
  961.   Procedure BasicShutdownBack;
  962. { This procedure deallocates memory used by the background
  963.   buffer.  BackgroundInit must be called to play music again. }
  964.  
  965.   Procedure BasicPlay (TuneString:String);
  966. { The BasicPlay procedure uses a string very similar to that used with the
  967.   PLAY verb in BASIC.  If the background buffer has not been installed,
  968.   BasicPlay will ignore the command to play music in the background (MB). }
  969.  
  970.   Function PlayBasicFile(Filename : String) : Boolean;
  971. { The PlayBasicFile function takes the name of a text file containing
  972.   lines of BASIC PLAY data.  It returns False if the file could not be
  973.   found or opened. }
  974.  
  975.   Function BasicPlayingInBack: Boolean;
  976. { BasicPlayingInBack return True if music is playing in the background,
  977.   False otherwise. }
  978.  
  979.   Procedure BasicPlayingMode(Action: SongAction);
  980. { BasicPlayingMode accepts one of these verbs:
  981.  
  982.            EndRepeatSong   Stop when finished
  983.            RepeatSong       Repeat when finished
  984.            ResumeSong       Continue music
  985.            StopSong       Stop music in buffer immediately
  986.            SuspendSong       Pause music }
  987.  
  988.  
  989.  
  990.        TPSBK  v1.00             TPSBK Basic Players                13
  991.  
  992.  
  993.  
  994.   Procedure BasicPlayANote(Oct,Note: Byte; Duration,Pause: Integer);
  995.  
  996. { BasicPlayANote puts a note into the background music buffer and starts
  997.   playing.  Oct is an octave (0-7).  Note is a note (1-13).  Duration is
  998.   the length of the note in milliseconds (1-32767).  Pause is the wait
  999.   after the note in milliseconds  (1-32767).  Its is used for staccato.
  1000.  
  1001.   NOTE VALUES:
  1002.  
  1003.        1)  C#     2)  D       3)  D#    4)  E    5)  F    6)  F#     7)  G
  1004.        8)  G#     9)  A      10)  A#   11)  B   12)  C   13)  Rest        }
  1005.  
  1006.  
  1007.   Implementation
  1008.   End.
  1009.  
  1010.  
  1011.        INTERFACE SECTION FOR SBBASIC.TPU :
  1012.  
  1013.   {Turbo Pascal SoundBlaster Basic Music Player by Trevor Robinson
  1014.    Copyright (c) 1991, Trevor Robinson
  1015.  
  1016.   Unit SBBasic;
  1017.  
  1018.   Interface
  1019.  
  1020.   Uses CRT, SBDrive;
  1021.  
  1022.   Var
  1023.     BasicAborted,
  1024.     BasicCheckAbort : Boolean;
  1025.  
  1026.  
  1027.   Procedure BasicPlay (TuneString:String);
  1028. { The BasicPlay procedure uses a string very similar to that used with the
  1029.   PLAY verb in BASIC. }
  1030.  
  1031.   Function PlayBasicFile(Filename : String) : Boolean;
  1032. { The PlayBasicFile function takes the name of a text file containing
  1033.   lines of BASIC PLAY data.  It returns False if the file could not be
  1034.   found or opened. }
  1035.  
  1036.  
  1037.   Implementation
  1038.   End.
  1039.  
  1040.        TPSBK  v1.00             TPSBK Basic Players                14
  1041.  
  1042.  
  1043.  
  1044.  
  1045.    If BasicCheckAbort  is True,  the unit  will check for Escape,  Control-
  1046.    Break,  and Control-C keys.     BasicPlay will abort and set BasicAbort to
  1047.    True.  If music is  playing in the background,  you must trap these keys
  1048.    and call PlayingMode(StopSong).
  1049.  
  1050.    The string characters are interpreted as follows:
  1051.  
  1052.       A .. G    The musical notes A thru G.  A note may be followed
  1053.                 by an accidental ('#' or '+' for sharp and '-' for
  1054.                 flat.)  Additionally, a note (With optional sharp or
  1055.                 flat) may also be followed by a number denoting the
  1056.                 note length (1 for a whole note thru 64 for a 64th
  1057.                 note.)   The note, with optional accidental and
  1058.                 length, may also be followed by one or more dots
  1059.                 ("."), each of which extends the note by one half
  1060.                 of its existing value.  For example, two dots produce
  1061.                 a length of 9/4 the original value, and three dots
  1062.                 a length of 27/8 the original value.
  1063.  
  1064.       Ln        Specifies the default length of the notes following
  1065.                 ("n" must be 1 for a whole note thru 64 for a 64th
  1066.                 note.)  The initial default value is 4 (quarter note.)
  1067.  
  1068.       Mz        Specifies the fraction of the note length that the
  1069.                 note is actually sounding.  "z" is one of the letters
  1070.                 "S", "N", or "L", which have these meanings:
  1071.  
  1072.                    MS   Music staccato   (3/4 of note length)
  1073.                    MN   Music normal     (7/8 of note length)
  1074.                    ML   Music legato     (all of note length)
  1075.  
  1076.         If SBBKBAS is being used, "z" can also be "F" or "B".
  1077.  
  1078.            MF    Music foreground (normal note length)
  1079.            MB    Music background (normal note length)
  1080.  
  1081.       On        Specifies the octave in which the notes following
  1082.                 are to be played (0 thru 7).  The initial default
  1083.                 octave is 3, which is the octave which begins at
  1084.                 middle C.
  1085.  
  1086.       Pn        Specifies that no sound is to be made for an
  1087.                 interval.  "n" (optional) is the note length (1
  1088.                 for a whole note thru 64 for a 64th note.)  If "n"
  1089.                 is omitted, the current default note length is used.
  1090.                 One or more dots may follow, each of which extends
  1091.                 the rest by one half of its existing value.
  1092.  
  1093.  
  1094.  
  1095.  
  1096.        TPSBK  v1.00           TPSBK PianoMan Players               15
  1097.  
  1098.  
  1099.  
  1100.  
  1101.       Tn        Specifies the tempo in beats per minute (32 thru
  1102.                 255.)  The initial default value is 120.
  1103.  
  1104.       >         Increases notes one octave.
  1105.  
  1106.       <         Decreases notes one octave.
  1107.  
  1108.    NOTE: You must use either SBBASIC or SBBKMUZ, NOT BOTH!  They have the
  1109.      same procedure and variable names and will get confused.  SBBASIC is
  1110.      only  included for programs  that don't need  background playing and
  1111.      don't want the extra size.
  1112.  
  1113.  
  1114.  
  1115.        TPSBK  v1.00           TPSBK PianoMan Players               16
  1116.  
  1117.  
  1118.  
  1119.  
  1120.        P I A N O M A N     P L A Y E R S
  1121.        ______________________________________________________________________
  1122.  
  1123.  
  1124.        INTERFACE SECTION FOR SBOPIANO.TPU :
  1125.  
  1126.   {Turbo Pascal SoundBlaster PianoMan Player by Trevor Robinson
  1127.    Copyright (c) 1991, Trevor Robinson}
  1128.  
  1129.   Unit SBOPiano;
  1130.  
  1131.   Interface
  1132.  
  1133.   Uses CRT,SBDrive;
  1134.  
  1135.   Var
  1136.     OldPianoCheckAbort : Boolean;
  1137.  
  1138.   Function PlayOldPiano(Filename : String) : Boolean;
  1139.  
  1140.   Implementation
  1141.   End.
  1142.  
  1143.  
  1144.  
  1145.   The function and variable names are the same in SBNPiano except the
  1146.   every "Old" is replace with a "New".  (PlayOldPiano is PlayNewPiano).
  1147.   If OldPianoCheckAbort is True, the unit aborts when a key is pressed.
  1148.  
  1149.  
  1150.  
  1151.  
  1152.        TPSBK  v1.00           TPSBK MultiPart Player               17
  1153.  
  1154.  
  1155.  
  1156.  
  1157.        M U L T I P A R T   P L A Y E R
  1158.        ______________________________________________________________________
  1159.  
  1160.  
  1161.        INTERFACE SECTION FOR SBOMULTI.TPU :
  1162.  
  1163.   {Turbo Pascal SoundBlaster Multi-Part PianoMan Player by Trevor Robinson
  1164.    Copyright (c) 1991, Trevor Robinson}
  1165.  
  1166.   Unit SBOMulti;
  1167.  
  1168.   Interface
  1169.  
  1170.   Uses CRT,SBDrive;
  1171.  
  1172.   Var
  1173.     OldMultiCheckAbort : Boolean;
  1174.  
  1175.   Procedure OldAddFile(Filename : String);
  1176. { Adds a file name to the Multiple Play List. }
  1177.  
  1178.   Procedure OldClearList;
  1179. { Clears the Multiple Play List }
  1180.  
  1181.   Function PlayOldMulti : Boolean;
  1182. { Plays files contained in the Multiple Play List.  Return true if
  1183.   successful. }
  1184.  
  1185.   Implementation
  1186.   End.
  1187.  
  1188.  
  1189.  
  1190.   If OldMultiCheckAbort is True, the unit aborts when a key is pressed.
  1191.  
  1192.  
  1193.  
  1194.        TPSBK  v1.00               TPSBK CMF Player                 18
  1195.  
  1196.  
  1197.  
  1198.  
  1199.        C M F   P L A Y E R
  1200.        ______________________________________________________________________
  1201.  
  1202.  
  1203.        INTERFACE SECTION FOR SBCMF.TPU :
  1204.  
  1205.   {Turbo Pascal SoundBlaster CMF Player by Trevor Robinson
  1206.    Copyright (c) 1991, Trevor Robinson}
  1207.  
  1208.   Unit SBCMF;
  1209.  
  1210.   Interface
  1211.  
  1212.   Uses CRT, DOS;
  1213.  
  1214.   Const
  1215.     FileDataSize = 64000;
  1216.   Type
  1217.     DataType = Array [1..FileDataSize] Of Byte;
  1218.     FileDataType = Record
  1219.       Id : Array[0..3] Of Char;
  1220.       Version : Integer;
  1221.       Inst_Blk : Integer;
  1222.       Music_Blk : Integer;
  1223.       Ticks_Per_Beat : Integer;
  1224.       Clock_Ticks : Integer;
  1225.       Music_Title : Integer;
  1226.       Composer_Name : Integer;
  1227.       Music_Remark : Integer;
  1228.       Channel_Used : Array[0..15] Of Char;
  1229.       Inst_Num : Integer;
  1230.       Basic_Tempo : Integer;
  1231.       MusicData : DataType;
  1232.     End;
  1233.     FileDataP = ^FileDataType;
  1234.   Var
  1235.     DriverInt : Byte;
  1236.  
  1237.  
  1238.   Function FindDriverInt : Byte;
  1239. { The function FindDriverInt searches the possible interrupts the CMF
  1240.   driver could be located at and returns its interrupt number.  It
  1241.   returns 0 if the driver is not loaded.  It is called during unit
  1242.   initialization.
  1243. }
  1244.  
  1245.   Function GetDriverVersion : Word;
  1246. { The function GetDriverVersion returns the version of the CMF driver
  1247.   currently in use.   The high and low order bytes  contain the major
  1248.   and minor version number, respectively.
  1249. }
  1250.  
  1251.  
  1252.  
  1253.        TPSBK  v1.00               TPSBK CMF Player                 19
  1254.  
  1255.  
  1256.  
  1257.   Procedure SetMusicStatusByte(Var StatusByte : Byte);
  1258. { SetMusicStatusByte provides the driver with the address of the music
  1259.   status byte.  The driver updates the byte under the following
  1260.   conditions:
  1261.  
  1262.     1. Reset it to 0 during initialization.
  1263.     2. Set it to FF hex when music output starts.
  1264.     3. Set it to 0 when the driver comes to the end of the music block.
  1265.     4. When it encounters a Control Event, the driver updates it with
  1266.        the value of the Control Data.
  1267.     5. Does not change it when the music is paused and resumed.
  1268. }
  1269.  
  1270.   Procedure LoadInstruments(Insts, SegInsts, OfsInsts : Word);
  1271. { The procedure LoadInstruments loads the  number of instruments speci-
  1272.   fied by Insts from the Instrument Block located at SegInsts:OfsInsts.
  1273. }
  1274.  
  1275.   Procedure SetMusicSpeed(Speed : Word);
  1276. { SetMusicSpeed informs  the driver of the clock  speed to use when it
  1277.   starts music output.  Speed is the clock frequency in hertz. The
  1278.   default is 96Hz.
  1279. }
  1280.  
  1281.   Procedure TransposeMusic(Semitone : Integer);
  1282. { TransposeMusic allows transposition of the music.  Semitone contains
  1283.   the number of semitones to transpose.  A positive value transposes the
  1284.   music to a higher key, a negative value transposes to a lower key.
  1285. }
  1286.  
  1287.   Function PlayMusic(SegMusic, OfsMusic : Word) : Word;
  1288. { PlayMusic plays the music block located at SegMusic:OfsMusic in the
  1289.   background.  The first byte of the music block must be a delta time of
  1290.   events which is usually zero.  The music status byte is set to FF hex.
  1291.   The driver programs the system timer using the clock rate set by
  1292.   SetMusicSpeed.  The music status byte it set to 0 when finished.  It
  1293.   returns 1 if another song is currently active.
  1294. }
  1295.  
  1296.   Function StopMusic : Word;
  1297. { StopMusic stops the music and resets the music status byte to 0.  It
  1298.   returns 1 if no music was active.
  1299. }
  1300.  
  1301.   Function ResetDriver : Word;
  1302. { ResetDriver turns off the FM chips and resets the instrument table to
  1303.   the default.  It returns a 1 if music was active.
  1304. }
  1305.  
  1306.   Function PauseMusic : Word;
  1307. { PauseMusic pauses the active music.  It returns 1 if no music was active.
  1308. }
  1309.  
  1310.  
  1311.  
  1312.        TPSBK  v1.00               TPSBK CMF Player                 20
  1313.  
  1314.  
  1315.  
  1316.   Function ResumeMusic : Word;
  1317. { ResumeMusic resumes the previously paused music.  Returns 1 if no music
  1318.   was paused.
  1319. }
  1320.  
  1321.   Function PlayCMFFile(Fname : String) : Word;
  1322. { PlayCMFFile plays a CMF file using the above commands.  It plays
  1323.   until a key is pressed or the music is finished.  If a key pressed,
  1324.   it is not captured.
  1325.  
  1326.   PlayCMFFile Return Codes :
  1327.  
  1328.     0 - No Error
  1329.     1 - FM Driver Not Installed
  1330.     2 - Error Opening File
  1331.     3 - Error Allocating Memory
  1332.     4 - Error Resetting Driver
  1333.     5 - Error Reading File
  1334.     6 - Error Playing Music
  1335.     7 - Error Stopping Music
  1336.     8 - Error Closing File
  1337. }
  1338.  
  1339.  
  1340.   Implementation
  1341.   End.
  1342.  
  1343.  
  1344. NOTE: Requires SBFMDRV.COM!!!
  1345.  
  1346.  
  1347.  
  1348.        TPSBK  v1.00              TPSBK Demo Files                  21
  1349.  
  1350.  
  1351.  
  1352.  
  1353.        D E M O     F I L E S
  1354.        ______________________________________________________________________
  1355.  
  1356.  
  1357.        SBDEMO.PAS contains examples of all TPSBK except PianoMan and CMF
  1358.        background playing.  It demonstrates fore/background basic playing,
  1359.        playing of old and new PianoMan files in the foreground, and playing
  1360.        of old and new Multiple Part PianoMan files.
  1361.  
  1362.        MUSICDOS.PAS demonstrates playing of PianoMan music files in the
  1363.        background.  It loads a file of your choice then exits to DOS, still
  1364.        playing your music file!  With a good song, it can take much of the
  1365.        boredom of DOS away.
  1366.  
  1367.        SBCMFDEM.PAS plays a Creative Music File (CMF) specified on the
  1368.        command-line.  (Requires SBFMDRV.COM)
  1369.  
  1370.  
  1371.        Demo Music Files:
  1372.  
  1373.        SOLFE.MUZ     BASIC music file: Solfeggietto
  1374.        CMINOR.MUS     Old PianoMan music file: C Minor
  1375.        DIXIE.MUZ     New PianoMan music file: Dixie
  1376.        ENTRTAN*.MUS     Old PianoMan multipart files: The Entertainer
  1377.        PAKLBEL*.MUS      Old PianoMan multipart files: PAKLBEL
  1378.        BADMAN.CMF     Awesome Creative Music File
  1379.  
  1380.  
  1381.        TPSBK  v1.00          Music Conversion Programs              22
  1382.  
  1383.  
  1384.  
  1385.  
  1386.        M U S I C   C O N V E R S I O N     P R O G R A M S
  1387.        ______________________________________________________________________
  1388.  
  1389.  
  1390.        BAS2MUS-
  1391.  
  1392.      Converts files containing basic PLAY verb data to PianoMan files in
  1393.      the format:
  1394.  
  1395.      FiledNote = Record
  1396.        Octave, Note, Staccato : Byte;
  1397.        Duration : Integer;
  1398.      End;
  1399.      NoteFile = File Of FiledNote;
  1400.  
  1401.        MUS2MUZ-
  1402.  
  1403.      Converts old PianoMan data files to new, smaller PianoMan 4.0 files
  1404.      in the format:
  1405.  
  1406.      FiledNote = Record
  1407.        Octave, NoteStaccato : Byte;
  1408.        Duration : Integer;
  1409.      End;
  1410.      NoteFile = File Of FiledNote;
  1411.  
  1412.      The 4 high order bits of NoteStaccato contain the note, the 4 low
  1413.      order bits contain the Staccato.
  1414.  
  1415.        MUZ2MUS-
  1416.  
  1417.          Converts new PianoMan 4.0 data files to old PianoMan files.
  1418.  
  1419.  
  1420.     TPSBK  v1.00        Programmers Programming Tips         A
  1421.  
  1422.  
  1423.  
  1424.  
  1425.        P R O G R A M M E R S   P R O G R A M M I N G   T I P S
  1426.        ______________________________________________________________________
  1427.  
  1428.  
  1429.  
  1430.  
  1431.        If you have any tips or suggestions to make TPSBK easier to use for
  1432.        others, please share them.
  1433.  
  1434.  
  1435.  
  1436.  
  1437.        TPSBK  v1.00        Common Questions and Answers             B
  1438.  
  1439.  
  1440.  
  1441.  
  1442.        C O M M O N   Q U E S T I O N S     A N D     A N S W E R S
  1443.        ______________________________________________________________________
  1444.  
  1445.  
  1446.  
  1447.  
  1448.        I haven't been asked any questions, yet......
  1449.  
  1450.  
  1451.  
  1452.  
  1453.     TPSBK  v1.00          Revision History             C
  1454.  
  1455.  
  1456.  
  1457.  
  1458.        R E V I S I O N     H I S T O R Y
  1459.        ______________________________________________________________________
  1460.  
  1461.  
  1462.        Version 1.00 - 7/23/91
  1463.      Completed!!!
  1464.  
  1465.  
  1466.  
  1467.        TPSBK  v1.00             Future Enhancements                 D
  1468.  
  1469.  
  1470.  
  1471.        F U T U R E   E N H A N C E M E N T S
  1472.        ______________________________________________________________________
  1473.  
  1474.  
  1475.        - Playing and Recording of VOC bigger than 64K
  1476.        - Double Disk Buffering Playing and Recording of VOC files
  1477.        - FM Music using Rhythm Mode
  1478.        - Text-to-Speech
  1479.        - AdLib ROL files
  1480.        - Anything else I can think of...
  1481.  
  1482.  
  1483.  
  1484.  
  1485.